package com.zeng.dao;

import com.zeng.pojo.User;
import org.apache.ibatis.annotations.*;

import java.util.List;
import java.util.Map;

/**
 * @author zeng
 * @data 2021/07/02 18:44
 */
public interface UserMapper {
    @Select("select * from user")
    List<User> getUser();

    //方法存在多个参数，所有的参数前面必须加上@Param()的注解,多个参数，不用排序，参数名要和实际的参数名一致
    @Select("select * from user where id = #{id}")
    User getUserById(@Param("id") int id);

    //更新条目
    @Update("update user set name =#{name},pwd = #{password} where id = #{id}")
    void Update(User user);

    //删除
    @Delete("delete from user where id = #{id}")
    void Delete(@Param("id") int id);
    //增加
    @Insert("insert into user (id, name, pwd) values (#{id},#{name},#{password})")
    void Insert(User user);
}
